package com.anti.modular.owner.ownerleasebilladjust.controller;

import com.anti.commom.annotation.BusinessLog;
import com.anti.commom.annotation.Permission;
import com.anti.commom.enums.LogAnnotionOpTypeEnum;
import com.anti.commom.api.Result;
import com.anti.jdbc.support.page.PageParam;
import com.anti.modular.owner.ownerleasebilladjust.param.OwnerLeaseBillAdjustParam;
import com.anti.modular.owner.ownerleasebilladjust.service.OwnerLeaseBillAdjustService;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

/**
 * 业主账单表调整表控制器
 *
 * @author anti
 * @date 2021-05-20 14:27:27
 */
@RestController
@RequestMapping("ownerLeaseBillAdjust")
public class OwnerLeaseBillAdjustController {

    @Resource
    private OwnerLeaseBillAdjustService ownerLeaseBillAdjustService;

    /**
     * 查询业主账单表调整表
     *
     * @author anti
     * @date 2021-05-20 14:27:27
     */
    @GetMapping("page")
    public Result page(PageParam pageParam, OwnerLeaseBillAdjustParam ownerLeaseBillAdjustParam) {
        return Result.data(ownerLeaseBillAdjustService.page(pageParam,ownerLeaseBillAdjustParam));
    }

    /**
     * 添加业主账单表调整表
     *
     * @author anti
     * @date 2021-05-20 14:27:27
     */
    @PostMapping("add")
    @BusinessLog(title = "业主账单表调整表_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public Result add(@RequestBody @Validated(OwnerLeaseBillAdjustParam.add.class) OwnerLeaseBillAdjustParam ownerLeaseBillAdjustParam) {
            ownerLeaseBillAdjustService.add(ownerLeaseBillAdjustParam);
        return Result.success("新增成功");
    }

    /**
     * 删除业主账单表调整表
     *
     * @author anti
     * @date 2021-05-20 14:27:27
     */
    @PostMapping("delete")
    @BusinessLog(title = "业主账单表调整表_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public Result delete(@RequestBody @Validated(OwnerLeaseBillAdjustParam.delete.class) OwnerLeaseBillAdjustParam ownerLeaseBillAdjustParam) {
            ownerLeaseBillAdjustService.delete(ownerLeaseBillAdjustParam);
        return Result.success("删除成功");
    }

    /**
     * 编辑业主账单表调整表
     *
     * @author anti
     * @date 2021-05-20 14:27:27
     */
    @PostMapping("edit")
    @BusinessLog(title = "业主账单表调整表_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public Result edit(@RequestBody @Validated(OwnerLeaseBillAdjustParam.edit.class) OwnerLeaseBillAdjustParam ownerLeaseBillAdjustParam) {
            ownerLeaseBillAdjustService.edit(ownerLeaseBillAdjustParam);
        return Result.success("修改成功");
    }

    /**
     * 查看业主账单表调整表
     *
     * @author anti
     * @date 2021-05-20 14:27:27
     */
    @GetMapping("detail")
    public Result detail(@Validated(OwnerLeaseBillAdjustParam.detail.class) OwnerLeaseBillAdjustParam ownerLeaseBillAdjustParam) {
        return Result.data(ownerLeaseBillAdjustService.detail(ownerLeaseBillAdjustParam));
    }

    /**
     * 业主账单表调整表列表
     *
     * @author anti
     * @date 2021-05-20 14:27:27
     */
    @GetMapping("list")
    public Result list(OwnerLeaseBillAdjustParam ownerLeaseBillAdjustParam) {
        return Result.data(ownerLeaseBillAdjustService.list(ownerLeaseBillAdjustParam));
    }

}
